<?php

namespace App\Models\Admin;


use App\Api\Traits\DateTrait;
use App\Api\Traits\Orm\BaseOrmTrait;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Permission\Models\Permission as ParentPermission;

class Permission extends ParentPermission
{
    use SoftDeletes, DateTrait, BaseOrmTrait;

    protected $dates = ['deleted_at'];
    protected $guarded = [];

    protected $casts = [
        'is_show' => 'boolean',
        'keep_alive' => 'boolean',
    ];

    /**
     * @return HasMany
     */
    public function children(): HasMany
    {
        return $this->hasMany(Permission::class, 'parent_id', 'id');
    }
}
